<%--                                                                       --%>
<%-- Copyright (c) 2005 BroadVision, Inc.  All rights reserved.            --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%
  String ctxPath = request.getContextPath();
%>

<script language="JavaScript">

//
//
//
function doQualifierDelete(form) {
  if (!confirm("<bean-el:message key="ep.qualifier.confirm.delete" bundle="ep.messages"/>")) return;

  form.action = "<c:url value="/ep/qualifierDelete.do"/>";
  form.submit();
}

//
//
//
function doQualifierValueDelete(qualifierValueId) {
  document.qualifierList.qualifierValueId.value = "";
  if (0 != qualifierValueId) {
    if (!confirm('<bean:message key="ep.qualifier.value.confirm.delete" bundle="ep.messages"/>')) return;
    document.qualifierList.qualifierValueId.value = qualifierValueId;
  }
  document.qualifierList.action = '<c:url value="/ep/qualifierValueDelete.do"/>';
  document.qualifierList.submit();
}

<%@ include file="/mc/common/jsutils.jsp" %>

</script>

<c:set var="editImg">
<img src="<%= ctxPath %>/ep/images/action/icon_edit.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean:message key="image.alt.edit" bundle="ep.messages"/>" title="<bean:message key="image.alt.edit" bundle="ep.messages"/>">
</c:set>
<c:set var="deleteImg">
<img src="<%= ctxPath %>/ep/images/action/icon_delete.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean:message key="image.alt.delete" bundle="ep.messages"/>" title="<bean:message key="image.alt.delete" bundle="ep.messages"/>">
</c:set>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle">
      <bean-el:message key="ep.qualifier.view.page.title" bundle="ep.messages" arg0="${epQualifierView.map.qualifierName}"/>
      </div>
      <div class="errorMessage"><html-el:errors bundle="ep.messages"/></div>

      <html-el:form action="/ep/qualifierEdit.do">
      <html-el:hidden value="${epQualifierView.map.qualifierId}" property="qualifierId"/>

      <div class="pageSubtitle">
        <span class="left"><bean-el:message key="ep.qualifier.information" bundle="ep.messages"/></span>
        <span class="right">
          <input type="submit" class="inputButton" value='<bean-el:message key="button.edit" bundle="ep.messages"/>'>
          <input type="button" class="inputButton" value='<bean-el:message key="button.delete" bundle="ep.messages"/>' onclick="doQualifierDelete(this.form);">
        </span>
      </div>

      </html-el:form>

      <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="label" width="30%"><bean-el:message key="ep.qualifier.name" bundle="ep.messages"/>:</td>
        <td class="labelField" width="70%"><c:out value="${epQualifierView.map.qualifierName}"/>
        </td>
      </tr>
      </table> 

      <div class="pageSubtitle">
        <span class="left"><bean-el:message key="ep.qualifier.values" bundle="ep.messages"/></span>
        <html-el:form action="/ep/qualifierValueNew">
        <span class="right"><input type="submit" class="inputButton" value="<bean:message key='button.new.qualifier.value' bundle="ep.messages"/>"/></span>
        <html-el:hidden value="${epQualifierView.map.qualifierId}" property="qualifierId"/>
        </html-el:form>
      </div>

<form name="qualifierList" method="post">

<input type="hidden" name="qualifierId" value="<c:out value="${epQualifierView.map.qualifierId}"/>"/>
<input type="hidden" name="qualifierValueId"/>

<c:if test="${not empty epQualifierView.map.qualifierValues}">
      <div class="globalButtonWrap">
        <input type="button" name="selectAllValues" class="globalButton" value="<bean:message key="button.selectAll" bundle="ep.messages"/>"
          onclick="check(this.form.qualifierValueIds, this);">
        <input type="button" class="globalButton" value="<bean:message key="button.delete" bundle="ep.messages"/>"
          onclick="if (isAnyChecked(this.form.qualifierValueIds, '<bean:message key="ep.qualifier.value.atLeastOne" bundle="ep.messages"/>', '<bean:message key="ep.qualifier.values.confirm.delete" bundle="ep.messages"/>')) doQualifierValueDelete(0);">
      </div>
</c:if>

      <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Search result table" width="100%">
        <tr class="listHeader">
          <th id="Checkboxes">&nbsp;</th>
          <th id="Name" align="left"><bean-el:message key="ep.header.name.qualifier.value" bundle="ep.messages"/></th>
          <th id="Editable" align="left" width="15%"><bean-el:message key="ep.qualifier.is.editable" bundle="ep.messages"/></th>
          <th id="Actions" align="left" nowrap><bean:message key="ep.header.actions" bundle="ep.messages"/></th>
        </tr>

        <!-- results -->

<c:forEach var="qualifierValue" items="${epQualifierView.map.qualifierValues}" varStatus="index">
    <c:url var="editUrl" value="/ep/qualifierValueEdit.do">
      <c:param name="qualifierId" value="${epQualifierView.map.qualifierId}"/>
      <c:param name="qualifierValueId" value="${qualifierValue.map.id}"/>
    </c:url>

    <c:choose>
      <c:when test="${(index.count + 1) % 2 == 0}">
        <tr class="listEven">
      </c:when> 
      <c:otherwise>
        <tr class="listOdd">
      </c:otherwise>
    </c:choose>         
          <td headers="Checkboxes" align="center"><input type="checkbox" name="qualifierValueIds" value="<c:out value="${qualifierValue.map.id}"/>" onclick="update(this.form.qualifierValueIds, this.form.selectAllValues);"></td>
          <td headers="Name"><c:out value="${qualifierValue.map.name}"/></td>
          <td headers="Editable">
            <c:if test="${qualifierValue.map.editable}">
            <bean-el:message key="ep.yes" bundle="ep.messages"/>
            </c:if>
            <c:if test="${!qualifierValue.map.editable}">
            <bean-el:message key="ep.no" bundle="ep.messages"/>
            </c:if>
          </td>
          <td headers="Actions"><a href='<c:out value="${editUrl}"/>'><c:out
            value='${editImg}' escapeXml="false"/></a>
            <a href="#" onclick="doQualifierValueDelete(<c:out value="${qualifierValue.map.id}"/>)"><c:out
            value='${deleteImg}' escapeXml="false"/></a>
          </td>

        </tr>
</c:forEach>

<c:if test="${empty epQualifierView.map.qualifierValues}">
        <tr class="listOdd">
          <td align="center" colspan="5">
            <bean:message key="ep.qualifier.values.noFound" bundle="ep.messages"/>
          </td>
        </tr>
</c:if>

      </table>

      <!-- pagination -->
<c:if test="${not empty epQualifierView.map.qualifierValues}">
<%@ include file="/mc/common/pager.jsp" %>
</c:if>

</form>

    </td>
  </tr>
</table>
